package cn.mysdp.biz.facade;


import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import cn.mysdp.biz.dto.request.*;
import cn.mysdp.biz.dto.response.*;
import cn.mysdp.biz.domain.*;
import cn.mysdp.biz.facade.*;
import cn.mysdp.biz.facade.*;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

/**
 * @ClassName: SdpWorkspaceConfigFacadeImpl
 * @Description:
 * @Author: SDP
 * @Date: 2021-10-30
 * @Version: 1.0
 * Table: sdp_workspace_config
 * Comment:
 * 
 */
@Service
public class SdpWorkspaceConfigFacadeImpl extends SdpWorkspaceConfigFacadeCustomImpl implements SdpWorkspaceConfigFacade {

    static {
        beanClassNameMap.put("sdp_workspace_config", "sdpWorkspaceConfigFacadeImpl");
        listMethodNameMap.put("sdp_workspace_config", "listSdpWorkspaceConfig");
        listMethodParameterClassNameMap.put("sdp_workspace_config", "SdpWorkspaceConfigQueryRequest");
        updateMethodNameMap.put("sdp_workspace_config", "updateSdpWorkspaceConfig");
        updateMethodParameterClassNameMap.put("sdp_workspace_config", "SdpWorkspaceConfigUpdateRequest");
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Integer addSdpWorkspaceConfig(SdpWorkspaceConfigAddRequest request) throws Exception {
        super.fixRequest("sdp_workspace_config", "add", request);
        return super.addSdpWorkspaceConfig(request);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Integer updateSdpWorkspaceConfig(SdpWorkspaceConfigUpdateRequest request) throws Exception {
        SdpWorkspaceConfig record = null;
        record = sdpWorkspaceConfigMapper.selectByPrimaryKey(request.getId());
        super.fixRequest("sdp_workspace_config", "update", request, record);
        return super.updateSdpWorkspaceConfig(request);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Integer deleteSdpWorkspaceConfig(SdpWorkspaceConfigDeleteRequest request) throws Exception {
        if (needCheckDeleteList(request)) {
            List<SdpWorkspaceConfig> list = null;
            SdpWorkspaceConfigExample example = new SdpWorkspaceConfigExample();
            example.createCriteria().andIdIn(request.getIdList());
            list = sdpWorkspaceConfigMapper.selectByExample(example);
            fixRequest("sdp_workspace_config", "delete", request, list);
        } else {
            fixRequest("sdp_workspace_config", "delete", request);
        }
        return super.deleteSdpWorkspaceConfig(request);
    }

    @Override
    public SdpWorkspaceConfigQueryResponse querySdpWorkspaceConfig(SdpWorkspaceConfigQueryRequest request) throws Exception {
        super.checkNonNull(request.getId(), "id");
        SdpWorkspaceConfigQueryResponse result = super.querySdpWorkspaceConfig(request);
        checkResult("sdp_workspace_config", "query", request, result);
        return result;
    }

    @Override
    public List<SdpWorkspaceConfigQueryResponse> listSdpWorkspaceConfig(SdpWorkspaceConfigQueryRequest request) throws Exception {
        List<SdpWorkspaceConfigQueryResponse> list = super.listSdpWorkspaceConfig(request);
        checkResult("sdp_workspace_config", "list", request, list);
        return list;
    }

    @Override
    public Integer countSdpWorkspaceConfig(SdpWorkspaceConfigQueryRequest request) throws Exception {
        clearPageInfo(request);
        super.fixRequest("sdp_workspace_config", "count", request);
        return super.countSdpWorkspaceConfig(request);
    }

    @Override
    public BaseStatResponse statSdpWorkspaceConfig(SdpWorkspaceConfigQueryRequest request) throws Exception {
        clearPageInfo(request);
        super.fixRequest("sdp_workspace_config", "stat", request);
        return super.statSdpWorkspaceConfig(request);
    }

    @Override
    public Integer batchUpdateValue(SdpWorkspaceConfigAddRequest request) throws Exception {
        super.fixRequest("sdp_workspace_config", "batch_update_value", request);
        Integer result = super.batchUpdateValue(request);
        checkResult("sdp_workspace_config", "batch_update_value", request, result);
        return result;
    }

    @Override
    public Integer clone(BaseNameIdRequest request) throws Exception {
        super.fixRequest("sdp_workspace_config", "clone", request);
        Integer result = super.clone(request);
        checkResult("sdp_workspace_config", "clone", request, result);
        return result;
    }

}
